package com.web.domain.dataTable;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Created by xukk on 2017/6/6.
 */
@Data
public class DataTableResponse implements Serializable{

    private static final long serialVersionUID = 1144860594283750313L;
    private Integer draw;

    private Long recordsTotal;

    private Long recordsFiltered;

    private List<?> data = Lists.newArrayList();

    private String error;
    public static Map<String,Object> convertToMap(List<Object>list){
        Map<String,Object>map = Maps.newHashMap();
        for(Object ob:list){
            Map<String,Object> param =(Map<String, Object>) ob;
            map.put(param.get("name")+"",param.get("value"));
        }
        return map;
    }
}
